package servlet;

import DBC.DatabaseConnection;
import Factory.DAOFactory;
import Factory.ServiceFactory;

import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @author: hank
 * @create: 2021-03-28 21:37
 **/
@WebServlet("/Beginner")
class beginnerServlet extends DispatcherServlet {
    private void beginner() throws IOException {
        Map<String,Object> map = new HashMap<>();
        try {
            map.put("List", ServiceFactory.getBeginnerServiceInstance().beginner());
            map.put("AllCount",ServiceFactory.getBeginnerServiceInstance().beginner().size());
        } catch (Exception e) {
            e.printStackTrace();
        }
        response.getWriter().print(com.alibaba.fastjson.JSONObject.toJSONString(map));
        System.out.println("Beginner"+new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    }
}
